/////////////////////////////////////////////////////////////////////////////
/*/	
 *	Creator:		Michael Duff
 *	Title:			
 *	Last Edited:	06/17/2013
 *	Summary:		
/*/
/////////////////////////////////////////////////////////////////////////////

#ifndef CGAME_H
#define CGAME_H

#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <string>
using namespace std;

class CSGD_Direct3D;
class CSGD_DirectInput;
class CSGD_TextureManager;
class CSGD_XAudio2;
class CGameState;
class CEntityManager;
class CParticleManager;
class CBitmapFont;
class CMessage;
class CMessageSystem;
class CLevelManager;

class CGame
{
public:
	static CGame* GetInstance( void );
	static void	  DeleteInstance( void );

	void Initialize( HWND hWnd, HINSTANCE hInstance,
				int nWidth, int nHeight, bool bWindowed );
	bool Main( void );
	void Terminate( void );

	// Game State Machine
	void	ChangeState( CGameState* pNewState );

	int GetScreenWidth(void) { return m_nScreenWidth; }
	int GetScreenHeight(void) { return m_nScreenHeight; }
	int GetSfxID (void) { return m_nSfxID; }
	int GetMusicID (void) { return m_nBackgroundMusicID; }
	int GetMenuMovID (void) { return m_nMenuMove; }
	int GetConfirmID (void) { return m_nMenuConfirm; }
	CBitmapFont* GetFont( void ) const	{	return m_pBF;	}
	int GetScreenMidPoint(string str, float scale);
	void ToggleFullScreen();
	bool GetFullScreen() { return m_bIsFullscreen; }
	void SetFullScreen(bool tof) { m_bIsFullscreen = tof; }
	CMessageSystem* GetMessageSystem() { return MessageSystem; }

	HINSTANCE ReturnInsance();

	static void MessgeProc( CMessage* pMsg );

	bool TestMessageThingBool;
	float TestMessageThingTimer;

private:

	static CGame* s_pInstance;

	CGame( void );
	~CGame( void );
	CGame( const CGame& );					
	CGame& operator= ( const CGame& );		
	bool Input( void );
	void Update( void );
	void Render( void );

	CSGD_Direct3D*			m_pD3D;
	CSGD_DirectInput*		m_pDI;
	CSGD_TextureManager*	m_pTM;
	CSGD_XAudio2*			m_pXA;
	CBitmapFont*			m_pBF;

	CGameState*				m_pCurrState;
	CEntityManager*			m_pEntityManager;
	CParticleManager*		m_pParticleManager;
	CLevelManager*			m_pLM;

	//*******************************************************
	// Window Attributes
	int						m_nScreenWidth;
	int						m_nScreenHeight;
	bool					m_bIsWindowed;
	bool					m_bIsFullscreen;

	int m_nBackgroundMusicID;
	int m_nSfxID;
	int m_nMenuMove, m_nMenuConfirm;

	// Current Time (in milliseconds)
	DWORD					m_dwCurrTime;

	HINSTANCE				hGrabInstance;

	CMessageSystem* MessageSystem;
};

#endif
